package com.wzl.day3;

/**
 * @author wuzhilang
 * @Title: Day3
 * @ProjectName questions
 * @Description: TODO
 * @date 7/18/20192:13 PM
 */

/**
 * 阅读以下代码：输出正确的是
 * public class Lazy {
 *
 *     private static boolean initialized = false;
 *
 *     static {
 *         Thread t = new Thread(() -> initialized = true);
 *         t.start();
 *         try {
 *             t.join();
 *         } catch (InterruptedException e) {
 *             throw new AssertionError(e);
 *         }
 *     }
 *
 *     public static void main(String[] args) {
 *         System.out.println(initialized);
 *     }
 * }以上程序输出内容是？
 * (a) true
 * (b) false
 * (c) 编译错误
 * (d) 以上答案都不对
 */
public class Day3 {
		private static boolean initialized = false;

		static {
			Thread t = new Thread(() -> initialized = true);
			t.start();
			try {
				t.join();
			} catch (InterruptedException e) {
				throw new AssertionError(e);
			}
		}

		public static void main(String[] args) {
			System.out.println(initialized);
		}
//		解析准备中，等博主看完解析视频再说，对于多线程里面的坑，无知狼人如其名，堪称无知。
		String a = String.format("%s", null);
}
